CSE 16: Applied Discrete Mathematics
Instructor: Owen Arden
Winter 2023
How do we know when something is true?
We are convinced by a persuasive argument!
What is the basis of persuasion?
Logic is one of the oldest intellectual disciplines, dating back to Aristotle
Aristotle’s logic focuses on the idea of deduction.
Subject : The objects we talk about in a
statement
Predicate : What we say about the
subject
Syllogism : Three statements where the
subject of the first is the predicate of the
second, and the third statement is implied by the first
two.
Proposition : A statement that is either
true or false.
In 1879 Gottlob Frege’s publishes Begriffsschrift
Frege introduces formal notation, some still used (\(\vdash\)).
Defines a propositional calculus in terms of
p := "You are a bird."
q := "You have wings."
Compound statements:
p := "??? is a bird."
q := "??? has wings."
p := "??? is a bird."
q := "??? has wings."
“I say what I mean.”
“I see what I eat.”
“I like what I get.”
“I breathe when I sleep.”
\(\neq\)
(why?)
“I mean what I say.”
“I eat what I see.”
“I get what I like.”
“I sleep when I breathe.”
Bertrand Russell (Master Bertie) reintroduced Aristotle’s distinction between subject and predicate
Some cats do not have fur: \(\exists \text{ cat}. \text{HasNoFur}(\text{cat})\)
All men are mortal: \(\forall \text{ man}. \text{IsMortal}(\text{man})\)
We need to create new propositions from given
facts.
A sound rule of inference should only
create true conclusions.
A proof, given a set of premises, is just a sequence of sentences where each element is
Axioms : Propositions that you assume to be
true. Ideally, truths that are self-evident.
Rules of inference : Rules that create new
propositions from axioms or other inferred propositions.
Some special names for inferred (proven to be true) propositions:
Using previously proven Lemmas, Theorems, and Corollaries (plus axioms), new results can be proven with rules of inference.
A proposition is a declarative sentence that is either true or false.
Notation for constructing propositions
We can specify the meaning of connectives using truth tables.
Truth table: A table with the truth-values of
a logical formula for each combination of values of its propositional
variables.
Truth tables were invented by Ludwig Wittgenstein, a student of Russell’s…
who once alledgedly threatened Karl Popper (another philosopher) with a fireplace poker.
The negation of a proposition \(p\) is written \(\neg p\) and has truth table:
\(p\) | \(\neg p\) |
---|---|
\(\textsf{T}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{T}\) |
Example: If \(p\) denotes “The earth is round.”, then \(\neg p\) denotes “It is not the case that the earth is round.”, or just “The earth is not round.”
The conjunction of propositions \(p\) and \(q\) is written \(p \wedge q\) and has truth table:
\(p\) | \(q\) | \(p \wedge q\) |
---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{F}\) |
Example: If \(p\) denotes “I am at home.” and \(q\) denotes “It is raining.” then \(p \wedge q\) denotes “I am home, and it is raining.”
The disjunction of propositions \(p\) and \(q\) is written \(p \vee q\) and has truth table:
\(p\) | \(q\) | \(p \wedge q\) |
---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{F}\) |
Example: If \(p\) denotes “I am at home.” and \(q\) denotes “It is raining.” then \(p \vee q\) denotes “I am home, or it is raining.”
In English, “or” has two distinct meanings.
The exclusive or of propositions \(p\) and \(q\) is written \(p \oplus q\) and has truth table:
\(p\) | \(q\) | \(p \oplus q\) |
---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{F}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{F}\) |
Example: If \(p\) denotes “I choose the soup.” and \(q\) denotes “I choose the salad.” then \(p \oplus q\) denotes “I choose the soup or I choose the salad.”
The implication of proposition \(p\) with respect to \(q\) is written \(p \rightarrow q\) and has truth table:
\(p\) | \(q\) | \(p \rightarrow q\) |
---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{???}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{???}\) |
Example: If \(p\) denotes “I am at home.” and \(q\) denotes “It is raining.” then \(p \rightarrow q\) denotes “If I am home, then it is raining.”
If I am at home and it is raining, then \(p \rightarrow q\) is true.
If I am at home and it is not raining, then \(p \rightarrow q\) is false.
The implication of proposition \(p\) with respect to \(q\) is written \(p \rightarrow q\) and has truth table:
\(p\) | \(q\) | \(p \rightarrow q\) |
---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{???}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{???}\) |
Example: If \(x > 2\) then \(x^2 > 4\).
The implication of proposition \(p\) with respect to \(q\) is written \(p \rightarrow q\) and has truth table:
\(p\) | \(q\) | \(p \rightarrow q\) |
---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) |
Example: If \(x > 2\) then \(x^2 > 4\).
In \(p \rightarrow q\) there doesn’t need to be any connection between the antecedent (\(p\)) or the consequent (\(q\)).
The “meaning” of \(p \rightarrow q\) only depends on the truth values of \(p\) and \(q\).
if \(p\) then \(q\)
if \(p\), \(q\)
\(q\), unless \(\neg p\)
\(q\) if \(p\)
\(q\) whenever \(p\)
\(q\) follows from \(p\)
\(p\) implies \(q\)
\(q\) only if \(p\)
\(q\) when \(p\)
\(p\) is sufficient for \(q\)
\(q\) is necessary for \(p\)
a sufficient condition for \(q\) is \(p\)
a necessary condition for \(p\) is \(q\)
\(p\): “You want to hang out.”
\(q\): “I will be in your city.”
\(p \rightarrow q\)?
If \(p\) and \(q\) are propositions, the we can form the biconditional proposition \(p \leftrightarrow q\), read as “\(p\) if and only if \(q\)”, with truth table:
\(p\) | \(q\) | \(p \leftrightarrow q\) |
---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) |
Example: If \(p\) denotes “I am at home.” and \(q\) denotes “It is raining.” then \(p \leftrightarrow q\) denotes “I am home if and only if it is raining.”
\(p\) if and only if \(q\)
\(p\) is necessary and sufficient for \(q\)
if \(p\) then \(q\), and conversely
\(p\) iff \(q\)
Tautology: a proposition that is always
true.
Contradiction: a proposition that is always
false.
\(p\) | \(\neg p\) | \(p \vee \neg p\) | \(p \wedge \neg p\) |
---|---|---|---|
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{F}\) |
Converse: The converse of \(p \rightarrow q\) is \(q \rightarrow p\).
Inverse: The inverse of \(p \rightarrow q\) is \(\neg p \rightarrow \neg q\).
Contrapositive: The contrapositive of
\(p \rightarrow q\) is \(\neg q \rightarrow \neg p\).
\(p\) | \(q\) | \(p \rightarrow q\) | \(q \rightarrow p\) | \(\neg p \rightarrow \neg q\) | \(\neg q \rightarrow \neg p\). |
---|---|---|---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
Notice anything about that last column (the contrapositive)?
It had the same values as \(p \rightarrow q\)!
That means the contrapositive of \(p \rightarrow q\) is logically equivalent!
Truth tables are a good way to show logical equivalence (and non-equivalence). Which of the below formulas are equivalent?
\(p\) | \(q\) | \(p \rightarrow q\) | \(\neg q \rightarrow \neg p\) | \(\neg p \vee q\) | \(q \rightarrow p\) |
---|---|---|---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) |
Logically equivalent: Two propositions \(p\) and \(q\) are logically equivalent iff \(p \leftrightarrow q\) is a tautology.
We write equivalence as \(P \Leftrightarrow Q\) or \(P \equiv Q\) where \(P\) and \(Q\) are compound propositions.
If \(P\) and \(Q\)’s truth tables agree, they are equivalent!
\(p\) | \(q\) | \(p \rightarrow q\) | \(\neg q \rightarrow \neg p\) | \(\neg p \vee q\) | \(q \rightarrow p\) |
---|---|---|---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) |
De Morgan’s Second Law: \[ \neg (p \wedge q) \equiv \neg p \vee \neg q\] \[ \neg (p \vee q) \equiv \neg p \wedge \neg q\]
Let’s prove it!
\(p\) | \(q\) | \(\neg (p \wedge q)\) | \(\neg p \vee \neg q\) | \(\neg (p \vee q)\) | \(\neg p \wedge \neg q\) |
---|---|---|---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{F}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
We fully can axiomatize (specify the axioms / assumptions of) propositional logic using similar equivalences.
Idempotence | \(p \vee p \equiv p\) | \(p \wedge p \equiv p\) |
Associativity | \((p \vee q) \vee r \equiv p \vee (q \vee r)\) | \((p \wedge q) \wedge r \equiv p \wedge (q \wedge r)\) |
Commutativity | \(p \vee q \equiv q \vee p\) | \(p \wedge q \equiv q \wedge p\) |
Distributivity | \(p \vee (q \wedge r) \equiv (p \vee q) \wedge (p \vee r)\) | \(p \wedge (q \vee r) \equiv (p \wedge q) \vee (p \wedge r)\) |
Identity | \(p \vee \textsf{F} \equiv p\) | \(p \wedge \textsf{T} \equiv \textsf{T}\) |
Domination | \(p \wedge \textsf{F} \equiv \textsf{F}\) | \(p \vee \textsf{T} \equiv \textsf{T}\) |
Dbl negation | \(\neg \neg p \equiv p\) | |
Complement | \(p \wedge \neg p \equiv
\textsf{F}\) \(~~~~~~\neg \textsf{T} \equiv \textsf{F}\) |
\(p \vee \neg p
\equiv \textsf{T}\) \(\neg \textsf{F} \equiv \textsf{T}\) |
De Morgans | \(\neg (p \vee q) \equiv \neg p \wedge \neg q\) | \(\neg (p \wedge q) \equiv \neg p \vee \neg q\) |
Absorption | \(p \vee (p \wedge q) \equiv p\) | \(p \wedge (p \vee q) \equiv p\) |
Conditional identity | \(p \rightarrow q \equiv \neg p \vee q\) | \(p \leftrightarrow q \equiv (p \rightarrow q) \wedge (q \rightarrow p)\) |
Propositional example:
How can we say “If one person knows another, then the second person knows the first.” without needing a proposition for every person?
Predicate logic adds new features to propositional logic:
Variables: \(x\), \(y\), \(z\)
Predicates: “\(x\) is even”,
“\(x^n + y^n\) = z^n”
Propositional functions: \(P(x)\), \(M(x,y,z)\)
Quantifiers: \(\forall\)
“for all”, \(\exists\)
“there exists”
Predicate: A logical statement whose truth
value depends on one or more variables.
Domain: The set of all possible values for
a variable.
Propositional function: A generalization
of a proposition defined by a predicate which becomes a proposition
when the predicate’s variables are replaced by elements from their
domain.
Example: Let the domain of \(x\) be the integers. \[P(x) := x > 0\]
Quantifiers let us talk about all or some
(i.e., at least one) of the elements in a variable’s
domain.
Around since Frege, but notation and popularization due mostly to his contemporary Peirce.
Charles Peirce (1839-1914)
Universal quantification: \(\forall x. P(x)\) reads “For all \(x\), \(P\)
of \(x\).” and asserts that \(P(x)\) is true for every
\(x\) in the domain.
Example: Let the domain of \(x\) be the integers.
Existential quantification: \(\exists x. P(x)\) reads “There exists an
\(x\) such that \(P\) of \(x\).” and asserts that \(P(x)\) is true for at least
one \(x\) in the domain.
Example: Let the domain of \(x\) be the integers.
Uniqueness quantification: \(\exists! x. P(x)\) reads “There is a unique
\(x\) such that \(P\) of \(x\).” and asserts that \(P(x)\) is true for one and only
one \(x\) in the domain.
Example: Let the domain of \(x\) be the integers.
Uniqueness quantification: \(\exists! x. P(x)\) reads “There is a unique
\(x\) such that \(P\) of \(x\).” and asserts that \(P(x)\) is true for one and only
one \(x\) in the domain.
Uniqueness is actually derivable in terms of \(\forall\), \(\exists\), and equality (\(=\)). \[\exists! x . P(x) \equiv \exists x . (P(x) \wedge \forall y . P(y) \rightarrow y = x)\]
Variables have a scope just like in a programming language.
In predicate logic, the scope of a variable is defined by a quantifier.
Occurrences of a variable within a quantifier’s scope are called bound. Occurrences which are not bound are called free.
Example: \[\exists y. P(x,y)\] Here \(x\) is free and \(y\) is bound.
One way to understand quantifiers is to think about the finite case.
One way to understand quantifiers is to think about the finite case.
Notice how our algorithms seemed similar, but opposite to each other? These equivalences make that explicit:
\[ \neg \forall x . P(x) \equiv \exists x. \neg P(x)\]
\[ \neg \exists x . P(x) \equiv \forall x. \neg P(x)\]
To get why, think about De Morgan’s Law:
\[\neg (P(x_0) \wedge P(x_1) \wedge~...) \equiv (\neg P(x_0) \vee \neg P(x_1) \vee ~...)\]
\[\neg (P(x_0) \vee P(x_1) \vee~...) \equiv (\neg P(x_0) \wedge \neg P(x_1) \wedge~...)\]
Define \(P(x)\) to be “\(x\) has taken a Python course.” where the domain of \(x\) is the set of students in the class. \[ \forall x. P(x) \]
Negating the statement gives “Is it not the case that every student in the class has taken Python.” \[ \neg \forall x. P(x) \]
Or put another way, “There is a student in the class who has not taken Python.” \[ \exists x. \neg P(x) \]
\[ \exists x. P(x)\]
Negating the statement gives “it not the case that there is a student in the class who has taken a Python course.” \[ \neg \exists x. P(x) \]
Or put another way, “Every student in the class has not taken a Python course.” \[ \forall x. \neg P(x) \]
Nested quantifiers are often necessary to express concepts.
Example: “Every real number has an inverse.”
\[\forall x \exists y. (x+y=0)\]
\[\forall x. Q(x)\]
Is \(\exists y \forall x\) the same as \(\forall x \exists y\)?
Consider \(P(x,y) := y\) is a soul mate of \(x\).
Examples:
Let \(P(x, y) := x \cdot y = 0\) where \(x\) and \(y\) are real numbers.
Let \(P(x, y) := x / y = 1\) where \(x\) and \(y\) are real numbers.
Statement | Statement is true | Statement is false |
---|---|---|
\(\forall x \forall y. P(x, y)\) \(\forall y \forall x. P(x, y)\) | \(P(x,y)\) is true for every pair \(x,y\). | There is at least on pair \(x,y\) for which \(P(x,y)\) is false. |
\(\forall x \exists y. P(x, y)\) | For every \(x\) there is a \(y\) for which \(P(x,y)\) is true. | There is an \(x\) such that \(P(x,y)\) is false for every \(y\). |
\(\exists x \forall y. P(x, y)\) | There is an \(x\) for which \(P(x,y)\) is true for every \(y\). | For every \(x\) there is a \(y\) for which \(P(x,y)\) is false. |
\(\exists x \exists y. P(x, y)\) \(\exists y \exists x. P(x, y)\) | There is a pair \(x,y\) for which \(P(x,y)\) is true. | \(P(x,y)\) is false for every pair \(x,y\) |
Recall De Morgan’s laws for quantifiers:
\[ \neg \forall x . P(x) \equiv \exists x. \neg P(x)\]
\[ \neg \exists x . P(x) \equiv \forall x. \neg P(x)\]
Let’s apply these laws to a statement with nested quantifiers.
\[\neg \exists p . \forall a . \exists f . P(p,f) \wedge Q(f,a)\]
Now let’s use De Morgan’s Laws to move the negation as far “inwards” as possible.
\(\neg \exists p . \forall a . \exists f . P(p,f) \wedge Q(f,a)\)
\(\forall p . \neg \forall a . \exists f . P(p,f) \wedge Q(f,a)\) by De Morgan’s for \(\exists\)
\(\forall p . \exists a . \neg \exists f . P(p,f) \wedge Q(f,a)\) by De Morgan’s for \(\forall\)
\(\forall p . \exists a . \forall f . \neg (P(p,f) \wedge Q(f,a))\) by De Morgan’s for \(\exists\)
\(\forall p . \exists a . \forall f . \neg P(p,f) \vee \neg Q(f,a)\) by De Morgan’s for \(\exists\)
#5 in English?
“For every person there is an airline such that for all flights, the person has not taken that flight or that flight is not on that airline.”
Example:
Let \(x,y,z\) have domain of the students in your school.
Let \(C(x) :=\) “\(x\) has a computer.”
Let \(F(x,y) :=\) “\(x\) and \(y\) are friends.”
Example: Translate “The sum of two positive integers is always positive” into an expression in predicate logic.
Solution:
Limit: Let \(f\) be a function defined on some open
interval that contains the number \(a\), except possibly at \(a\) itself. Then we say that the
limit of \(f(x)\) as \(x\) approaches \(a\) is \(L\), and we write
\[\lim _{x \to a} f(x)=L\] if for
every number \(\varepsilon > 0\)
there is a number \(\delta > 0\)
such that \[\text{if } 0 < |x - a|
< \delta \text{ then } |f(x) - L| < \varepsilon\]
We can use quantifiers to express the definition of the limit of a real-valued function \(f(x)\) of a real variable \(x\) at a point \(a\) in its domain.
\[\forall \varepsilon . \exists \delta . \forall x . (0 < |x - a| < \delta \rightarrow |f(x) - L| < \varepsilon)\]
where the domain of \(\varepsilon\) and \(\delta\) is the positive reals and the domain of \(x\) is all reals.
How could we use our logical definition of limits to express that the limit of \(f(x)\) as \(x\) approaches \(a\) does not exist?
\(\equiv \exists \varepsilon . \neg \exists \delta . \forall x . (0 < |x - a| < \delta \rightarrow |f(x) - L| < \varepsilon)\)
\(\equiv \exists \varepsilon . \forall \delta . \neg \forall x . (0 < |x - a| < \delta \rightarrow |f(x) - L| < \varepsilon)\)
\(\equiv \exists \varepsilon . \forall \delta . \exists x . \neg (0 < |x - a| < \delta \rightarrow |f(x) - L| < \varepsilon)\)
\(\equiv \exists \varepsilon . \forall \delta . \exists x . \neg ( \neg (0 < |x - a| < \delta) \vee |f(x) - L| < \varepsilon)\)
\(\equiv \exists \varepsilon . \forall \delta . \exists x . 0 < |x - a| < \delta \wedge \neg (|f(x) - L| < \varepsilon)\)
\(\equiv \exists \varepsilon . \forall \delta . \exists x . 0 < |x - a| < \delta \wedge |f(x) - L| \geq \varepsilon\)
Tautology: a proposition that is always
true.
Contradiction: a proposition that is always
false.
Logically equivalent: Two propositions \(p\) and \(q\) are logically equivalent,
written \(p \equiv q\), iff \(p \leftrightarrow q\) is a tautology.
So far we have only proven tautologies, contradictions, and equivalence using truth tables. This approach is not scalable.
With \(n\) variables, there are \(2^n\) truth assignments. Worse, truth tables cannot be used with quantifiers and infinite sets!
\(p\) | \(q\) | \(r\) |
---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{F}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{F}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{F}\) |
How can we get new conclusions from existing premises without enumerating all truth values?
IDEA: Can we manipulate logical statements symbolically using axioms and inference rules to obtain a proof of the desired conclusion?
A proof is the verification of a a mathematical statement starting from a set of agreed-upon first principles proceeding by unambiguous and unabridged logical steps or rules of inference.
Theorem: any inference obtained from
Notation:
Zybook also calls theorems valid arguments.
Three axioms:
(actually 4 originally, but one turned out to be
redundant) \[\begin{align}
A1&: \alpha \to (\beta \to \alpha) \\
A2&: (\alpha \to (\beta \to \gamma)) \to ((\alpha \to \beta) \to
(\alpha \to \gamma)) \\
A3&: (\neg \alpha \to \neg \beta) \to (\beta \to \alpha) \\
\end{align}
\]
One inference rule: Modus Ponens \[ p, p \to q \vdash q \]
From which all theorems of propositional logic can be derived!
Hilbert’s Axioms are tautologies!
Can you prove it?
\(\alpha\) | \(\beta\) | \(\beta \to \alpha\) | \(\alpha \to (\beta \to \alpha)\) |
---|---|---|---|
\(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{T}\) | \(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) | \(\textsf{T}\) |
\(\textsf{F}\) | \(\textsf{F}\) | \(\textsf{T}\) | \(\textsf{T}\) |
Wondering how they figured out one of the axioms was redundant?
They proved it could be derived from the other axioms!
\[\begin{align} A1&: \alpha \to (\beta \to \alpha) \\ A2&: (\alpha \to (\beta \to \gamma)) \to ((\alpha \to \beta) \to (\alpha \to \gamma)) \\ A3&: (\neg \alpha \to \neg \beta) \to (\beta \to \alpha) \\ \end{align}\]
Goal: Derive \(\vdash \alpha \to \alpha\) using only axioms and modus ponens.
\[\begin{align} & p \to ((q \to p) \to p) \tag{1}\\ & \quad \quad \text{A1 with } \alpha = p \text{ and } \beta = (q \to p). \\ & (p \to ((q \to p) \to p) \to ((p \to (q \to p)) \to (p \to p))) \tag{2} \\ & \quad \quad \text{A2 with } \alpha = p \text{ and } \beta = (q \to p) \text{ and } \gamma = p. \\ & (p \to (q \to p)) \to (p \to p) \tag{3} \\ & \quad \quad \text{ modus ponens using (1) and (2)} \\ & (p \to (q \to p)) \tag{4} \\ & \quad \quad \text{ A1 with } \alpha = p \text{ and } \beta = q \\ & p \to p \\ & \quad \quad \text{ modus ponens using (3) and (4)} \\ \end{align}\]
Show it is a valid argument (is a theorem)!
Consider this argument: \[\alpha \to \beta, \beta \to \gamma \vdash \alpha \to \gamma\]
What do we need to prove to show this argument is a theorem?
In general \[p_0, ..., p_n \vdash q\] is valid (true for all truth values of \(p_i\) and \(q\)) if \[(p_0 \wedge ... \wedge p_n) \to q\] is a tautology.
\[\alpha \to \beta, \beta \to \gamma \vdash \alpha \to \gamma\]
\[\begin{align} A1&: \alpha \to (\beta \to \alpha) \\ A2&: (\alpha \to (\beta \to \gamma)) \to ((\alpha \to \beta) \to (\alpha \to \gamma)) \\ A3&: (\neg \alpha \to \neg \beta) \to (\beta \to \alpha) \\ \end{align}\]
\[\begin{align} (1) & \beta \to \gamma & \text{Premise}\\ (2) & (\beta \to \gamma) \to (\alpha \to (\beta \to \gamma)) & \text{A1}\\ (3) & \alpha \to (\beta \to \gamma) & \text{MP w/ (1),(2)}\\ (4) & (\alpha \to (\beta \to \gamma)) \to ((\alpha \to \beta) \to (\alpha \to \gamma)) & \text{A2}\\ (5) & (\alpha \to \beta) \to (\alpha \to \gamma) & \text{MP w/ (3),(4)}\\ (6) & \alpha \to \beta & \text{Premise}\\ (7) & \alpha \to \gamma & \text{MP w/ (5),(6)} \end{align}\]
Notice: Every line is either a premise, an instance of an axiom, or the result of applying a theorem or rule (e.g., MP) to previous line(s).
Rule | Name |
---|---|
\(p,p \to q \vdash q\) | Modus ponens |
\(\neg q,p \to q \vdash \neg p\) | Modus tollens |
\(q\vdash p \vee q\) | Addition (L) |
\(p\vdash p \vee q\) | Addition (R) |
\(p \wedge q\vdash p\) | Simplification (L) |
\(p \wedge q\vdash q\) | Simplification (R) |
\(p, q\vdash p \wedge q\) | Conjunction |
\(p \to q, q \to r \vdash p \to r\) | Hypothetical syllogism |
\(p \vee q, \neg p \vdash q\) | Disjunctive syllogism |
\(p \vee q, \neg p \vee r \vdash q \vee r\) | Resolution |
What about quantifiers?
\[ \begin{prooftree} \AxiomC{$\forall x. \text{Human}(x) \to \text{Mortal}(x)$} \AxiomC{$\text{Human}(\text{Socrates})$} \BinaryInfC{$\therefore \text{Mortal}(\text{Socrates})$} \end{prooftree} \]
or
\[\forall x. \text{Human}(x) \to \text{Mortal}(x), \text{Human}(\text{Socrates}) \vdash \text{Mortal}(\text{Socrates})\]
\(*\): updated to be slightly less gender-biased
\[\begin{prooftree} \AxiomC{$\forall x. P(x)$} \UnaryInfC{$\therefore P(c)$} \end{prooftree}\]
\[\forall x.P(x) \vdash P(c)\]
where \(c\) is from the domain of \(x\).
Example: For the domain of all dogs, where Thornton is a dog.
\[\begin{prooftree} \AxiomC{$P(c)$} \UnaryInfC{$\therefore \forall x. P(x)$} \end{prooftree}\]
\[P(c) \vdash \forall x.P(x)\]
where \(c\) is an arbitrary element from the domain of \(x\).
This is often left implicit in proofs when a statement has been proven in terms of an arbitrary element.
Example: Consider an arbitrary natural number \(n\).
\[\begin{prooftree} \AxiomC{$\exists x. P(x)$} \UnaryInfC{$\therefore P(c)$} \end{prooftree}\]
\[P(c) \vdash \exists x.P(x)\]
for some element \(c\) in the domain
of \(x\)
(but you don’t know
which one).
Example:
\[\begin{prooftree} \AxiomC{$P(c)$} \UnaryInfC{$\therefore \exists x. P(x)$} \end{prooftree}\]
\[P(c) \vdash \exists x.P(x)\]
for some element \(c\) in the domain
of \(x\)
(but you may or may not
know which one).
Example:
Michelle would sometimes be called the “witness” to the existential since her existence proves the quantified statement.
\[ \begin{prooftree} \AxiomC{$\forall x. \text{Human}(x) \to \text{Mortal}(x)$} \AxiomC{$\text{Human}(\text{Socrates})$} \BinaryInfC{$\therefore \text{Mortal}(\text{Socrates})$} \end{prooftree} \]
\[\begin{align} & \forall x. \text{Human}(x) \to \text{Mortal}(x) &(1)&\quad\quad \text{Premise}\\ & \text{Human}(\text{Socrates}) \to \text{Mortal}(\text{Socrates}) &(2)&\quad\quad \text{UI},(1)\\ & \text{Human}(\text{Socrates}) &(3)&\quad\quad \text{Premise}\\ & \text{Mortal}(\text{Socrates}) &&\quad\quad \text{MP},(3),(2) \end{align}\]
\[ \begin{prooftree} \AxiomC{$\forall x. \text{Human}(x) \to \text{Mortal}(x)$} \RightLabel{(UI)} \UnaryInfC{$\text{Human}(\text{Socrates}) \to \text{Mortal}(\text{Socrates})$} \AxiomC{$\text{Human}(\text{Socrates})$} \RightLabel{(MP)} \BinaryInfC{$\therefore \text{Mortal}(\text{Socrates})$} \end{prooftree} \]
Example: Suppose:
Construct a valid argument (prove) that the following conclusion follows from these premises.
Solution:
Define:
\[\begin{align} (1) \quad \quad &\exists x. C(x) \wedge \neg B(x) &\text{Premise}\\ (2) \quad \quad &C(a) \wedge \neg B(a) &\text{EI on (1)}\\ (3) \quad \quad &C(a) &\text{Simplification (L) on (2)}\\ (4) \quad \quad &\forall x. C(x) \to P(x) &\text{Premise}\\ (5) \quad \quad &C(a) \to P(a) &\text{UI on (4)}\\ (6) \quad \quad &P(a) &\text{MP from (3) and (5)}\\ (7) \quad \quad &\neg B(a) &\text{Simplification (R) on (2)}\\ (8) \quad \quad &P(a) \wedge \neg B(a) &\text{Conjunction on (6) and (7)}\\ (9) \quad \quad &\exists x. P(x) \wedge \neg B(x) &\text{EG from (8)}\\ \end{align}\]
\[\begin{prooftree} \AxiomC{$\exists x. C(x) \wedge \neg B(x)$} \RightLabel{(EI)} \UnaryInfC{$C(a) \wedge \neg B(a)$} \RightLabel{(Simpl)} \UnaryInfC{$C(a)$} \AxiomC{$\forall x. C(x) \to P(x)$} \RightLabel{(UI)} \UnaryInfC{$C(a) \to P(a)$} \RightLabel{(MP)} \BinaryInfC{$P(a)$} \AxiomC{$\exists x. C(x) \wedge \neg B(x)$} \RightLabel{(EI)} \UnaryInfC{$P(a) \wedge \neg B(a)$} \RightLabel{(Simpl)} \UnaryInfC{$\neg B(a)$} \RightLabel{(Conj)} \BinaryInfC{$P(a) \wedge \neg B(a)$} \RightLabel{(EG)} \UnaryInfC{$\exists x. P(x) \wedge \neg B(x)$} \end{prooftree} \]
Rule | Condition | Name |
---|---|---|
\(\forall x.P(x) \vdash P(c)\) | \(c\) is an element in domain of \(P\) | Universal Instantiation |
\(P(c) \vdash \forall x.P(x)\) | \(c\) is an arbitrary element in domain of \(P\) | Universal Generalization |
\(\exists x.P(x) \vdash P(c)\) | \(c\) is a “fresh” name for some particular element in domain of \(P\) | Existential Instantiation |
\(P(c) \vdash \exists x.P(x)\) | \(c\) is a particular element in domain of \(P\) | Existential Generalization |